//加载列表下的标签信息
$("textarea[name='label']").each(function(){
	if($(this).val()!=''){
		var list = eval($(this).val());
		for(var i=0;i<list.length;i++){
			$(this).before('<a href="'+_ctx+'/blog/index?label='+list[i].id+'" class="am-badge am-text-md appLabel"><em>'+list[i].name+'</em></a>&nbsp;');
		}
	}
});

$("div#recBtn").find("button").each(function(){
	$(this).on('click',function(){
		//检查是否登陆,
		if(!_isLogin){
			$("div#app-modal-login").modal('open');
			return;
		}
		var type = $(this).attr('data-val');
		var id = $(this).attr('data-id');
		$.ajax({
			url:_ctx+"/blog/rec",
			type:'POST',
			data:{type:type,id:id},
			context:this,
			beforeSend:function(){
				$(this).attr('disabled','disabled');
			},
			dataType:'json',
			success:function(res){
				var type = $(this).attr('data-val');
				if(res.success){
					if(type=='1'){
						$(this).html('<i class="am-icon-thumbs-o-up"></i>&nbsp;推荐+1');
					}else{
						$(this).html('<i class="am-icon-thumbs-o-down"></i>&nbsp;无用-1');
					}
					$(this).attr('disabled',true);
				}else{
					$(this).removeAttr('disabled');
				}
			}
		});
	});
});

$("div#text-detail").find("img").addClass("am-img-responsive");

//浏览数
setTimeout(function(){
	var $artId = $("article#text-detail").attr('artId');
	if($artId){
		$.ajax({
			url:_ctx+"/blog/vinc",
			type:'POST',
			data:{id:$artId},
			context:this,
			dataType:'html',
			success:function(res){}
		});
	}
},5000);

//百度分享
window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"32"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];